package com.qingxin.wuye.entity;

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.codehaus.jackson.annotate.JsonIgnore;
import org.hibernate.annotations.GenericGenerator;

/**
 * WyBuilding entity. 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "wy_building")
public class WyBuilding extends com.qingxin.sys.entity.BaseEntity implements
		java.io.Serializable {
	private static final long serialVersionUID = 1115099866342087321L;
	// Fields

	private String buildingid;
	private WyGarden wyGarden;
	private String buildingCode;
	private String buildingName;
	private String address;
	private String buildingType;
	private String buildingStruct;
	private String buildingOrientation;
	private BigDecimal area;
	private String remark;
	private String createBy;
	private Date createTime;
	private String updateBy;
	private Date updateTime;
	private Set<WyRoom> wyRooms = new HashSet<WyRoom>(0);

	private String gardenName;
	
	
	// Constructors

	/** default constructor */
	public WyBuilding() {
	}

	public WyBuilding(String buildingid) {
		this.buildingid = buildingid;
	}

	public WyBuilding(String buildingid, String buildingName, String gardenid) {
		this.buildingid = buildingid;
		this.buildingName = buildingName;
		this.wyGarden = new WyGarden(gardenid);
	}

	public WyBuilding(String buildingid, String buildingCode,
			String buildingName, String address, String buildingType,
			String buildingStruct, String buildingOrientation, BigDecimal area,
			String remark, String gardenName) {
		this.buildingid = buildingid;
		this.buildingCode = buildingCode;
		this.buildingName = buildingName;
		this.address = address;
		this.buildingType = buildingType;
		this.buildingStruct = buildingStruct;
		this.buildingOrientation = buildingOrientation;
		this.area = area;
		this.remark = remark;
		this.gardenName = gardenName;
	}

	/** full constructor */
	public WyBuilding(WyGarden wyGarden, String buildingCode,
			String buildingName, String address, String buildingType,
			String buildingStruct, String buildingOrientation, BigDecimal area,
			String remark, String createBy, Date createTime,
			String updateBy, Date updateTime,
			Set<WyRoom> wyRooms) {
		this.wyGarden = wyGarden;
		this.buildingCode = buildingCode;
		this.buildingName = buildingName;
		this.address = address;
		this.buildingType = buildingType;
		this.buildingStruct = buildingStruct;
		this.buildingOrientation = buildingOrientation;
		this.area = area;
		this.remark = remark;
		this.createBy = createBy;
		this.createTime = createTime;
		this.updateBy = updateBy;
		this.updateTime = updateTime;
		this.wyRooms = wyRooms;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "uuid.hex")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "buildingid", unique = true, nullable = false, length = 32)
	public String getBuildingid() {
		return this.buildingid;
	}

	public void setBuildingid(String buildingid) {
		this.buildingid = buildingid;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "gardenid")
	@JsonIgnore
	public WyGarden getWyGarden() {
		return this.wyGarden;
	}

	public void setWyGarden(WyGarden wyGarden) {
		this.wyGarden = wyGarden;
	}

	@Column(name = "building_code", length = 50)
	public String getBuildingCode() {
		return this.buildingCode;
	}

	public void setBuildingCode(String buildingCode) {
		this.buildingCode = buildingCode;
	}

	@Column(name = "building_name", length = 50)
	public String getBuildingName() {
		return this.buildingName;
	}

	public void setBuildingName(String buildingName) {
		this.buildingName = buildingName;
	}

	@Column(name = "address", length = 500)
	public String getAddress() {
		return this.address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Column(name = "building_type", length = 50)
	public String getBuildingType() {
		return this.buildingType;
	}

	public void setBuildingType(String buildingType) {
		this.buildingType = buildingType;
	}

	@Column(name = "building_struct", length = 50)
	public String getBuildingStruct() {
		return this.buildingStruct;
	}

	public void setBuildingStruct(String buildingStruct) {
		this.buildingStruct = buildingStruct;
	}

	@Column(name = "building_orientation", length = 50)
	public String getBuildingOrientation() {
		return this.buildingOrientation;
	}

	public void setBuildingOrientation(String buildingOrientation) {
		this.buildingOrientation = buildingOrientation;
	}

	@Column(name = "area", precision = 12, scale = 2)
	public BigDecimal getArea() {
		return this.area;
	}

	public void setArea(BigDecimal area) {
		this.area = area;
	}

	@Column(name = "remark")
	public String getRemark() {
		return this.remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "create_by", length = 50)
	public String getCreateBy() {
		return this.createBy;
	}

	public void setCreateBy(String createBy) {
		this.createBy = createBy;
	}

	@Column(name = "create_time", length = 23)
	public Date getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Column(name = "update_by", length = 50)
	public String getUpdateBy() {
		return this.updateBy;
	}

	public void setUpdateBy(String updateBy) {
		this.updateBy = updateBy;
	}

	@Column(name = "update_time", length = 23)
	public Date getUpdateTime() {
		return this.updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "wyBuilding")
	@JsonIgnore
	public Set<WyRoom> getWyRooms() {
		return this.wyRooms;
	}

	public void setWyRooms(Set<WyRoom> wyRooms) {
		this.wyRooms = wyRooms;
	}

	
	@Transient
	public String getGardenName() {
		return gardenName;
	}

	public void setGardenName(String gardenName) {
		this.gardenName = gardenName;
	}
	
	
}